<template>
	<view style="width: 100%;height: 100vh;overflow-y: hidden;">
		<view id="home"
			style="margin-top: 24rpx;margin-left: 30rpx;float: left;margin-bottom: 18rpx;position: fixed;top: 0;"
			class="home acea-row row-center-wrapper iconfont icon-xiangzuo h5_back" @tap="returns">
		</view>
		<view id="J_prismPlayer" style="margin-top: 80rpx;"></view>
	</view>
</template>
<script>
	const app = getApp();
	import {
		getPlayAuthMini
	} from '@/api/camp.js';
	import Aliplayer from 'aliyun-aliplayer';
	import 'aliyun-aliplayer/build/skins/default/aliplayer-min.css';
	import {
		getDailyDataByType,
	} from '@/api/home.js';
	import {
		loginMobile,
	} from "@/api/user";
	import {
		mapGetters
	} from "vuex";
	import animationType from '@/utils/animationType.js'

	export default {
		data() {
			return {
				playurl: ',',
				videoId: '',
				playId: ''
			}
		},
		created() {
			let that = this;
		},
		onLoad(options) {
			let that = this;
			that.playurl = options.playurl;
			that.videoId = options.videoId;
			that.playId = options.id;
			console.log('!@#----------------' + options.playurl);
		},
		mounted: function() {
			let that = this;
			that.getAuth();

		},
		methods: {
			returns() {
				uni.navigateBack();
			},
			getAuth() {
				let that = this;
				let p = {};
				p.id = that.playId;
				getPlayAuthMini(p).then(res => {
					console.log(that.videoId)
					var player = new Aliplayer({
							//source: that.playurl, // 播放地址，可以是第三方点播地址，或阿里云点播服务中的播放地址。
							//domain: "https://www.mae.vip", // 申请 License 时填写的域名
							license: {
								domain: "mayimae.com",
								key: "zP7itq7iWZ50BaZNMf671dcdc53ca43d8afb7962e4b7df524"
							},
							id: "J_prismPlayer",
							vid: res.videoId,
							playauth: res.PlayAuth,
							qualitySort: "asc",
							format: "m3u8",
							mediaType: "video",
							encryptType: 1,
							width: "100%",
							height: "230px",
							autoplay: true,
							isLive: false,
							cover: res.VideoMeta.CoverURL,
							rePlay: false,
							playsinline: true,
							preload: true,
							controlBarVisibility: "hover",
							useH5Prism: true
						},
						function(player) {
							console.log("The player is created.");
						}
					);
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	page,
	body {
		height: 100%;
		width: 100%;
		background-color: white;
	}

	.header {
		width: 100%;
		height: 280rpx;
	}
</style>